<?php

namespace App\Http\Controllers;

use App\Models\Login;
use Illuminate\Http\Request;

class LoginController extends Controller
{
    //
    public function addUser()
    {
        dd(2);
        $login = new Login();
        $mobile = '18868195348';
        $password = "aa123456";
        $name = 'ffff';
        $salt = $this->salt();
        $password = $this->passwordEncrypt($password, $salt);
        $result = $login->addUser($mobile, $password, $name, $salt);
        echo $result;
    }

    private function salt()
    {
        $salt = substr(md5(time()), 6, 8);
        return $salt;
    }

    private function passwordEncrypt($password, $salt)
    {
        return md5(md5($password) . $salt);
    }

}
